package com.yuexin.project.finance.bill.controller;

import com.yuexin.common.utils.security.ShiroUtils;
import com.yuexin.framework.aspectj.lang.annotation.Log;
import com.yuexin.framework.aspectj.lang.enums.BusinessType;
import com.yuexin.framework.web.controller.BaseController;
import com.yuexin.framework.web.domain.AjaxResult;
import com.yuexin.framework.web.page.TableDataInfo;
import com.yuexin.project.finance.bill.domain.Bill;
import com.yuexin.project.finance.bill.domain.RushBill;
import com.yuexin.project.finance.bill.formbean.BillListFormBean;
import com.yuexin.project.finance.bill.formbean.MoneyBillListFormBean;
import com.yuexin.project.finance.bill.service.IBillService;
import com.yuexin.project.system.user.domain.User;
import com.yuexin.project.system.user.service.IUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 余额报表 信息操作处理
 *
 * @author zoncont.ahanu
 * @date 2019-03-08
 */
@Controller
@RequestMapping("/finance/bill/money")
@Api(value = "余额报表 信息操作处理", description = "余额报表 信息操作处理")
public class BillMoneyController extends BaseController {
    private String prefix = "finance/bill";

    @Autowired
    private IBillService billService;
    @Autowired
    private IUserService userService;

    @RequiresPermissions("finance:bill:money:view")
    @GetMapping()
    @ApiOperation("余额报表")
    public String moneyBill(ModelMap mmap) {
        mmap.put("users", userService.selectByCompanyId(ShiroUtils.getCompanyId()));
        return prefix + "/moneyBill";
    }

    @RequiresPermissions("finance:bill:money:list")
    @PostMapping("/moneyList")
    @ResponseBody
    @ApiOperation("余额报表数据")
    public TableDataInfo selectMoneyBillLists(MoneyBillListFormBean form) {
        form.setCompanyId(ShiroUtils.getCompanyId());
        startPage();
        return getDataTable(billService.selectMoneyBill(form));
    }
}
